/* 
 * File:   Clustering.h
 * Author: alessio
 *
 * Created on 20 gennaio 2010, 14.59
 */

#ifndef _CLUSTERING_H
#define	_CLUSTERING_H

//#include "Config.h"
#include "request.h"


#ifdef	__cplusplus
extern "C" {
#endif

    
    double *centroids;

    typedef struct centroid {
        int class_id;
        double center;
        unsigned long n_item;
        double sum;
        double probability_element;
        double standard_deviation;
    } KMeansCluster;

    PartitionedRequest * minimal_point;
    PartitionedRequest * maximal_point;
    double range;
    KMeansCluster *cluster;
    int max;

    typedef struct cv{
        double intercluster;
        double intracluster;
        double beta_cv;
    } CoefficentVariation;

    #define MAX_ITERATION 100000

double computeKMeansClustering(int n_class);
void getClusterMembership(PartitionedRequest * r, KMeansCluster * c, int n_class);

#ifdef	__cplusplus
}
#endif

#endif	/* _CLUSTERING_H */

